import http from '@/utils/request'
import type { 
  EquipmentQuery, 
  EquipmentCreateDTO, 
  EquipmentUpdateDTO, 
  EquipmentVO 
} from '@/types/device'
import type { Result, PageResult } from '@/types/response'
import type { AxiosResponse } from 'axios'

/** 分页查询设备列表 */
export function getEquipmentList(params: EquipmentQuery): Promise<AxiosResponse<Result<PageResult<EquipmentVO>>>> {
  return http.get<Result<PageResult<EquipmentVO>>>('/admin/equipment', { params })
}

/** 创建设备 */
export function createEquipment(data: EquipmentCreateDTO): Promise<AxiosResponse<Result<EquipmentVO>>> {
  return http.post<Result<EquipmentVO>>('/admin/equipment', data)
}

/** 更新设备 */
export function updateEquipment(equipmentId: number, data: EquipmentUpdateDTO): Promise<AxiosResponse<Result<EquipmentVO>>> {
  return http.put<Result<EquipmentVO>>(`/admin/equipment/${equipmentId}`, data)
} 